var db=openDatabase('mydb','1.0','testDb',2*1024*1024);
db.transaction(function(tx) {
 tx.executeSql("CREATE TABLE test (id int UNIQUE, mytitle TEXT, timestamp REAL)");
});

//Insert
db.transaction(function(tx) {
 tx.executeSql("INSERT INTO test (mytitle, timestamp) values(?, ?)", ["WEB Database", new Date().getTime()], null, null);
});


/*
//更新记录：

db.transaction(function(tx) {
 tx.executeSql("update test set mytitle=? where mytitle = 'fsafdsaf'",['xp'],null,null);
});


*/
//查询记录：

db.transaction(function(tx) {
 tx.executeSql("SELECT * FROM test", [],  
  function(tx, result) {
   for(var i = 0; i < result.rows.length; i++){ 
   document.write('<b>' + result.rows.item(i)['mytitle'] + '</b><br />'); 
  } 
 }, function(){
  alert("error");
 }); 
});


/*
//删除表：

db.transaction(function(tx) {
 tx.executeSql("DROP TABLE test");
})

*/

console.dir(db);